#!/usr/bin/env python
# encoding: utf-8
"""
@Author: Beam
@Mail:506556658@qq.com
@file: 进程pipe.py
@time: 2017/5/8 9:11
"""

from multiprocessing import Process,Pipe   #从进程模块导入方法Process和Pipe

def f(child_process):
    child_process.send([42,None,"Hello from child process！"])
    child_process.close()  #close方法

if __name__ == '__main__':
    parent_process,child_process = Pipe()   ##进程pipe方法实例化后会产生2个对象，一个是父进程那边的，一个是子进程那边的，可以想象为A和B
    process = Process(target=f,args=(child_process,))   #传递一端到子进程
    process.start()
    print(parent_process.recv())   #recv是接收，对应的是send
    process.join

